<template>
  <div id="app">
    <loading :ishow="ishow"></loading>
      <div >
        <keep-alive>
            <transition name="fade1">
          <router-view class="child-view" v-if="$route.meta.keepAlive">
              <!-- 这里是会被缓存的视图组件，比如 Home！ -->
          </router-view>
          </transition>
        </keep-alive>
          <transition name="fade1">
        <router-view class="child-view" v-if="!$route.meta.keepAlive">  </router-view>
          </transition>

      </div>
  </div>
</template>

<script>
import {mapGetters} from "vuex"
import loading from "./components/loading.vue"
export default {
  name: 'App',
  data(){
    return{

    }
  },
  computed:{
    ishow(){
      return this.$store.state.ishow;
    }
    // ...mapGetters(["ishow"])
  },
  components: {
    loading
  }
}
</script>

<style lang="less">
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;

}
.child-view {
    position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      box-sizing: border-box;
}
/* 进来之后 */
.fade1-enter-active, .fade1-leave-active {
  transition: all .4s;
  transform: translate(0px,0px);
}
/* 进入之前  */
.fade1-enter {
  opacity: 0;
  transform: translate(-100%,0px);
}
/* 离开之后  */
.fade1-leave-active{
  opacity: 0;
  transform: translate(100%,0px);
}
</style>
